﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:p="clr-namespace:Lithnet.Acma.Presentation"
                    xmlns:a="clr-namespace:Lithnet.Acma;assembly=Lithnet.Acma"
                    xmlns:fim="clr-namespace:Microsoft.MetadirectoryServices;assembly=Microsoft.MetadirectoryServicesEx"
                    xmlns:core="clr-namespace:Lithnet.Common.Presentation;assembly=Lithnet.Common.Presentation">

    <DataTemplate  DataType="{x:Type p:AcmaSchemaAttributeViewModel}">
        <StackPanel>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Label Content="Name"
                       Grid.Row="0"
                       Grid.Column="0" />
                <TextBox Text="{Binding Name, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}"
                         Grid.Row="0"
                         Grid.Column="1" 
                         Margin="10 0 0 0"
                         IsReadOnly="{Binding IsBuiltIn}"/>

                <Label Content="Data type"
                       Grid.Row="1"
                       Grid.Column="0" />
                <TextBox Text="{Binding TypeName, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=OneWay}"
                         Grid.Row="1"
                         Margin="10 0 0 0"
                         Grid.Column="1"
                         IsReadOnly="True"/>

                <CheckBox Content="Multivalued"
                          Grid.Row="2"
                          Grid.Column="1"
                          Margin="2"
                          VerticalAlignment="Center"
                          IsEnabled="False"
                          IsChecked="{Binding IsMultivalued, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=OneWay}" />

                <CheckBox Content="Indexable"
                          Grid.Row="3"
                          Grid.Column="1"
                          Margin="2"
                          VerticalAlignment="Center"
                          IsEnabled="False"
                          IsChecked="{Binding IsIndexable, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=OneWay}" />

                <CheckBox Content="Indexed"
                          Grid.Row="4"
                          Grid.Column="1"
                          Margin="2"
                          VerticalAlignment="Center"
                          IsEnabled="{Binding IsIndexable, Mode=OneWay}"
                          IsChecked="{Binding IsIndexed, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, Mode=TwoWay}" />

                <Label Content="Supported Operation"
                       Grid.Row="5"
                       Grid.Column="0" />
                <ComboBox ItemsSource="{Binding Source={core:EnumExtension {x:Type a:AcmaAttributeOperation}}, Mode=OneWay}"
                          SelectedValue="{Binding Operation, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                          SelectedValuePath="Value"
                          IsEnabled="{Binding CanModify}"
                          Grid.Row="5"
                          Grid.Column="1" />

                <Label Content="This is a built-in attribute and cannot be changed"
                       Grid.Row="6"
                       Grid.ColumnSpan="2"
                       Visibility="{Binding IsBuiltIn, Converter={StaticResource BooleanToVisibilityConverter}}" />
                
            </Grid>
        </StackPanel>
    </DataTemplate>
    
</ResourceDictionary>